package com.huawei.Galenus.dao;

import com.huawei.Galenus.domain.Proposal;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProposalRepository {

    @Insert("insert into proposal(uid,ssaId,name,description,goalAmount,donationAmount,status)" +
            "values(#{uid},#{ssaId},#{name},#{description},#{goalAmount},#{donationAmount},#{status})")
    Integer save(Proposal proposal);

    @Select("select * from proposal ssaId=#{ssaId}")
    List<Proposal> selectAll(@Param("ssaId") String ssaId);

    @Update("update proposal set donationAmount=donationAmount+#{amount} where id=#{pid}")
    Integer updateAmount(@Param("pid") Integer pid, @Param("amount") Double amount);
}
